package per.turtle.gateway.service;

import per.turtle.common.core.exception.valid.CaptchaException;
import per.turtle.common.core.web.entity.CommonResult;

import java.io.IOException;

/**
 * 验证码处理
 *
 * @author turtle
 */
public interface ValidateCodeService {

    /**
     * 生成验证码
     *
     * @return CommonResult
     * @throws IOException      异常
     * @throws CaptchaException 异常
     */
    CommonResult<?> createCaptcha() throws IOException, CaptchaException;

    /**
     * 校验验证码
     *
     * @param key   key
     * @param value value
     * @throws CaptchaException 异常
     */
    void checkCaptcha(String key, String value) throws CaptchaException;

}
